#!./common/bats/bin/bats
# -*-sh-*-

load ./common/test_helper_functions
source ./common/functions || exit 1

if [ -s ./common/TEST_ENV ];then
    source ./common/TEST_ENV
fi

check_rms
rm=$RESOURCE_MANAGER

NODES=2
TASKS=8
ARGS=8

module load $python_module_prefix-mpi4py

@test "[dev-tools/$python_module_prefix-mpi4py] python hello world ($rm/$LMOD_FAMILY_COMPILER/$LMOD_FAMILY_MPI)" {
    if [ -z ${_python} ];then
	flunk "\${_python} not set"
    fi

    if [ ! -s helloworld.py ];then
	flunk "helloworld.py does not exist"
    fi

    if [ "$LMOD_FAMILY_MPI" == "mvapich2" ];then
        export MV2_SUPPORT_DPM=1
    fi


    run_mpi_binary "${_python} helloworld.py" $ARGS $NODES $TASKS
    assert_success
}
